#include <repository/employee/employee_repository.h>

using namespace model;

// CRUD Operations
insert_ret_type EmployeeRepository::create(const EmployeeDTO& employee_dto)
{
  return _insert(employee_dto);
};

select_ret_type<EmployeeDTO>
EmployeeRepository::get(const std::string& employee_name)
{
  return _select(db::employee{}.employee_name == employee_name);
};

update_ret_type EmployeeRepository::updateById(const in_id_type id,
                                               const EmployeeDTO& dto)
{
  return _update(dto, db::employee{}.employee_id == dto.employee_id);
};

delete_ret_type EmployeeRepository::removeById(const in_id_type id)
{
  return _remove(db::employee{}.id == id);
}

// Custom Queries
select_ret_type<EmployeeDTO> EmployeeRepository::getAll()
{
  return _select(db::employee{}.id >= 0);
}

select_ret_type<EmployeeDTO> EmployeeRepository::getByPage(int page_size,
                                                           int offset)
{
  return _select_from(db::employee{}.id >= 0, page_size, offset);
}

count_type EmployeeRepository::count()
{
  return _countById();
}

// 其他方法实现...
